package com.scsystem.xysc.pojo.vo;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ReturnResult<T> implements Serializable {

    public static final long serialVersionUID=1564561564894123165L;

    private int code;

    private String message;

    private T data;

    public ReturnResult(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public ReturnResult<T> success(String message, T data) {
        return new ReturnResult<T>(200, message, data);
    }

    public ReturnResult<T> fail(String message, T data) {
        return new ReturnResult<T>(400, message, data);
    }
}
